#define  _CRT_SECURE_NO_WARNINGS 1
using namespace std;
#include<iostream>
#include<vector>
#include<list>
#include<algorithm>
#include<time.h>
void test_op1();
int main() {
	list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(4);
	lt.push_back(5);
	lt.push_back(3);
	lt.push_back(3);	
	lt.push_back(1);	
	lt.push_back(4);
	list<int>::iterator it = lt.begin();
	while (it!=lt.end())
	{
		*it += 10;
		it++;
	}
	for (auto ch :lt)
	{
		cout << ch << " ";
	}
	cout << endl;
	lt.sort();
	//sort(lt.begin(), lt.end());
	for (auto ch : lt)
	{
		cout << ch << " ";
	}
	cout << endl;
	lt.unique();
	for (auto ch : lt)
	{
		cout << ch << " ";
	}
	cout << endl;
	test_op1();
	return 0;
}

void test_op1()
{
	srand(time(0));
	const int N = 1000000;

	list<int> lt1;
	list<int> lt2;

	vector<int> v;

	for (int i = 0; i < N; ++i)
	{
		auto e = rand();
		lt1.push_back(e);
		v.push_back(e);
	}

	int begin1 = clock();
	// 
	sort(v.begin(), v.end());
	int end1 = clock();

	int begin2 = clock();
	lt1.sort();
	int end2 = clock();

	printf("vector sort:%d\n", end1 - begin1);
	printf("list sort:%d\n", end2 - begin2);
}
